package com.hspedu.bignum_;

import java.math.BigInteger;

public class BigInteger_ {
    public static void main(String[] args) {
        long l = 123434344343352l;
        System.out.println("l=" + l);
        System.out.println("===========");

        //编程中，需要处理很大的整数，long 不够用
        BigInteger bigInteger = new BigInteger("3432546567576687856543532445434");
        BigInteger bigInteger1 = new BigInteger("235453465765743");
        System.out.println(bigInteger);
        System.out.println(bigInteger1);

        //在对 BigInteger 进行加减乘除的时候，需要使用对应的方法，不能直接进行 + - * /
        BigInteger add = bigInteger.add(bigInteger1);//加
        System.out.println(add);
        BigInteger subtract = bigInteger.subtract(bigInteger1);//减
        System.out.println(subtract);
        BigInteger multiply = bigInteger.multiply(bigInteger1);//乘
        System.out.println(multiply);
        BigInteger divide = bigInteger.divide(bigInteger1);//除
        System.out.println(divide);
    }
}
